package com.eduadmin.service;

import com.eduadmin.entity.Semester;
import com.eduadmin.mapper.SemesterMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SemesterServiceImpl implements ISemesterService {

    private final SemesterMapper semesterMapper;

    @Autowired
    public SemesterServiceImpl(SemesterMapper semesterMapper) {
        this.semesterMapper = semesterMapper;
    }

    @Override
    public void addSemesters(List<Semester> semesters) {
        semesterMapper.insertSemeters(semesters);
    }

    public List<Semester> getAllSemester() {
        return semesterMapper.getAllSemester();
    }

    @Override
    public Semester getSemesterByName(String semesterName) {
        return semesterMapper.selectSemesterByName(semesterName);
    }
}
